package myJs

import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import myJs.myPkg.jquery._
import org.scalajs.dom.{Element, document}
import Implicits._
import myJs.myPkg.DraggableOptions
import myJs.tool.Tool
import myJs.tool.Tool._

import scalajs.js

/**
 * Created by yz on 2019/4/25
 */
@JSExportTopLevel("App")
object App {

  @JSExport("init")
  def init = {
    registerEvent
    $.ajaxSetup(JQueryAjaxSettings.cache(false))

    val shareTitle = "iMAP Cloud"
    val beforeTitle = $("#shareTitle").text()
    $("#shareTitle").text(s"${beforeTitle}-${shareTitle}")

    $(".sidebar-toggler").on("click", (y: Element) => {
      val image = $(y).parent().find("img")
      if (!$("body").hasClass("page-sidebar-closed")) {
        image.hide()
        $(y).parent().css("width", "45px")
      } else {
        image.show()
        $(y).parent().css("width", "235px")
      }
    })

    if ($(".myOperate").exist) {
      $(".myOperate").attr("title", messages("filteringAndSort"))
    }

  }

  def registerEvent = {

  }

}
